package com.jjlin.chapter_5;

import java.util.*;
public class CD98{

    //字符串的统计字符串
    public static String getCountString(String str){
        if(str == null || str.length() == 0 || str.equals(""))
            return "";
        char[] ch = str.toCharArray();
        int n = str.length(), num = 1;
        StringBuilder sb = new StringBuilder();
        sb.append(ch[0]);
        for(int i = 1; i < n; i++){
            if(ch[i] != ch[i - 1]){
                sb.append("_" + num + "_" + ch[i]);
                num = 1;
                continue;
            }
            num++;
        }
        sb.append("_" + num);
        return sb.toString();
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.println(getCountString(str));
    }
}
